Skip to content

Add simple markdown formatting to rustc --explain output#112697

Merged
bors merged 1 commit intorust-lang:masterfrom
tgross35:explain-markdown
Jul 5, 2023
Merged

Add simple markdown formatting to rustc --explain output#112697
bors merged 1 commit intorust-lang:masterfrom
tgross35:explain-markdown

Conversation

@tgross35
Copy link
Copy Markdown
Contributor

@tgross35 tgross35 commented Jun 16, 2023

This is a second attempt at #104540, which is #63128 without dependencies.

This PR adds basic markdown formatting to rustc --explain output when available. Currently, the output just displays raw markdown: this works of course, but it really doesn't look very elegant. (output is rustc --explain E0038)

image

After this patch, sample output from the same file:

image

This also obeys the --color always/auto/never command option. Behavior:

  • If pager is available and supports color, print with formatting to the pager
  • If pager is not available or if printing with formatting to stdout fails, fallback to printing without formatting
  • Follow --color always/never if supplied
  • If everything fails, just print plain text to stdout

r? @oli-obk
cc @estebank
(since the two of you were involved in the previous discussion)

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-error-codes Area: Explanation of an error code (--explain) merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants